sort hashmap by value and then by key